package backend;

public class MUX {

	private Object[] inputs;
	private int size;

	public MUX(Object[] inputs, int size) {
		this.inputs = inputs;
		if (size == 2 || size == 8)
			this.size = size;
	}

	public Object getOutput(String selectLine) {
		int sl = Integer.parseInt(selectLine, 2);
		if (sl < this.size && inputs[sl] != null)
			return inputs[sl];
		return null;
	}
}
